package com.io;

import java.io.*;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 86184
 * Date: 2023-11-30
 * Time: 11:40
 */
//public class Test2 {
//    public static void main(String[] args) throws IOException {
//        BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter("C:\\Javacode2\\c.txt", true));
//        bufferedWriter.write("中国6666\n中国人民万岁");
//        bufferedWriter.flush();
//        bufferedWriter.close();
//
//    }
//}


public class Test2 {
    public static void main(String[] args) throws IOException {
        //字节流
        FileOutputStream fileOutputStream = new FileOutputStream("c:\\Javacode2\\c.txt", true);
        //转换流
        OutputStreamWriter outputStreamWriter = new OutputStreamWriter(fileOutputStream,"gbk");
        //字符流
        BufferedWriter bufferedWriter = new BufferedWriter(outputStreamWriter);
        bufferedWriter.newLine();
        bufferedWriter.write("中华人民万岁！");
        bufferedWriter.flush();

        fileOutputStream.close();
        outputStreamWriter.close();
        bufferedWriter.close();

    }
}
